<!DOCTYPE html>
<html>
<head>
<title>一键管理权限</title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>

</head>
<body>
<div class="container">

	<div class="panel panel-default">
		<div class="panel-heading">修改权限</div>
		<div class="panel-body">
			<form>
				<div class="form-group">
					<label for="exampleInputEmail1">用户ID：</label>
					<input type="uid" class="form-control" id="uid" placeholder="用户ID">
				</div>
				<button type="button" class="btn btn-default" id="add">添加</button>
				<button type="button" class="btn btn-default" id="del">删除</button>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
	$('#add').on('click', function () {
		if($('#uid').val()) {
			$.post('{:U("addAllPower")}', {uid:$('#uid').val()}, function (data) {
				data = $.parseJSON(data);
				alert(data.msg);
			});
		} else {
			alert('请填写用户ID');
		}
	});

	$('#del').on('click', function () {
		if($('#uid').val()) {
			$.post('{:U("delAllPower")}', {uid:$('#uid').val()}, function (data) {
				data = $.parseJSON(data);
				alert(data.msg);
			});
		} else {
			alert('请填写用户ID');
		}
	});	
});
</script>
</body>
</html>